package com.dadibadi.core.work.controller;

import com.dadibadi.core.work.qo.WorkInfoIdQO;
import com.dadibadi.core.work.service.WorkInfoService;
import com.dadibadi.core.work.vo.WorkInfoDetailVO;
import com.venusoft.developer.common.result.CommonResult;
import com.venusoft.developer.common.result.ICommonResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * TODO
 *
 * @author : lkfs@163.com
 * @date : 2025-08-18 16:46
 * 根据作品id获取作品信息
 */

@RestController
@RequestMapping("/work")
@Slf4j
@Tag(name = "api/作品信息", description = "")
public class ApiWorkInfoGetController {
   @Resource
    WorkInfoService workInfoService;

    @PostMapping("/api-work-info-get")
    @Operation(summary = "详情", description = "")
    @ApiResponses(value = {@ApiResponse(responseCode = "200", content = {@Content(schema = @Schema(implementation = WorkInfoDetailVO.class), mediaType = "application/json")})})
    public ICommonResult exec(
            @RequestBody @Parameter(required = true) @Validated WorkInfoIdQO qo,
            @RequestHeader(required = false) String platform,
            @RequestHeader(required = false) String version,
            @RequestHeader(required = false, name = "Accept-Language") String language,
            HttpServletRequest request) {


        WorkInfoDetailVO vo = workInfoService.getWorkInfo(qo);
        return new CommonResult<>(vo);


    }
}
